package com.qianlou.controller;

import com.qianlou.common.result.BaseResponse;
import com.qianlou.common.result.PagedResult;
import com.qianlou.pojo.bo.SubmitAnswerBO;
import com.qianlou.service.InterviewRecordService;
import com.qianlou.task.ChatGLMTask;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/interviewRecord")
public class InterviewRecordController {

    @Resource
    private ChatGLMTask chatGLMTask;

    @Resource
    private InterviewRecordService interviewRecordService;

    @PostMapping("/collect")
    public BaseResponse collect(@RequestBody SubmitAnswerBO submitAnswerBO) {
        chatGLMTask.display(submitAnswerBO);
        return BaseResponse.ok();
    }

    @GetMapping("/list")
    public BaseResponse list(@RequestParam String realName,
                                @RequestParam String mobile,
                                @RequestParam(defaultValue = "1", name = "page") Integer page,
                                @RequestParam(defaultValue = "10", name = "pageSize") Integer pageSize) {
        PagedResult result = interviewRecordService.selectList(realName, mobile, page, pageSize);
        return BaseResponse.ok(result);
    }
}